<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace app\admin\controller;


/**
 * 栏目管理控制器
 */
class Consultant extends AdminBase
{
    /**
     * 咨询师列表
     * @return type
     */
    public function consultantList()
    {    
        
        $this->assign('list', $this->logicConsultant->getConsultantList());
        
        return $this->fetch('consultant_list');
    }
    
    /**
     * 咨询师添加
     * @return type
     */
    public function consultantAdd()
    {
        $this->consultantCommon();
        
        $this->assign('info', []);
        
        return $this->fetch('consultant_edit');
    }
    
    /**
     * 保存咨询师
     */
    public function consultantEdit()
    {         
        $this->consultantCommon();
        
        $info = $this->logicConsultant->getConsultantInfo(['a.consultant_id' => $this->param['consultant_id']]);
 
        $this->assign('info', $info);
        
        return $this->fetch('consultant_edit');
    }
    
    /**
     * 更改栏目状态
     */
    public function setStatus()
    {
       $this->jump($this->logicAdminBase->setStatus('Consultant', $this->param));
    }


    /**
     * 咨询师添加与编辑通用方法
     */
    public function consultantCommon()
    {
        
        IS_POST && $this->jump($this->logicConsultant->consultantEdit($this->param));//判断是否表单提交 是则跳转保存处理
    }
}
